package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DocCategoryMapper;
import com.ruoyi.system.domain.DocCategory;
import com.ruoyi.system.service.IDocCategoryService;
import com.ruoyi.common.core.text.Convert;

/**
 * 文档分类Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-25
 */
@Service
public class DocCategoryServiceImpl implements IDocCategoryService 
{
    @Autowired
    private DocCategoryMapper docCategoryMapper;

    /**
     * 查询文档分类
     * 
     * @param categoryId 文档分类主键
     * @return 文档分类
     */
    @Override
    public DocCategory selectDocCategoryByCategoryId(Long categoryId)
    {
        return docCategoryMapper.selectDocCategoryByCategoryId(categoryId);
    }

    /**
     * 查询文档分类列表
     * 
     * @param docCategory 文档分类
     * @return 文档分类
     */
    @Override
    public List<DocCategory> selectDocCategoryList(DocCategory docCategory)
    {
        return docCategoryMapper.selectDocCategoryList(docCategory);
    }

    /**
     * 新增文档分类
     * 
     * @param docCategory 文档分类
     * @return 结果
     */
    @Override
    public int insertDocCategory(DocCategory docCategory)
    {
        docCategory.setCreateTime(DateUtils.getNowDate());
        return docCategoryMapper.insertDocCategory(docCategory);
    }

    /**
     * 修改文档分类
     * 
     * @param docCategory 文档分类
     * @return 结果
     */
    @Override
    public int updateDocCategory(DocCategory docCategory)
    {
        docCategory.setUpdateTime(DateUtils.getNowDate());
        return docCategoryMapper.updateDocCategory(docCategory);
    }

    /**
     * 批量删除文档分类
     * 
     * @param categoryIds 需要删除的文档分类主键
     * @return 结果
     */
    @Override
    public int deleteDocCategoryByCategoryIds(String categoryIds)
    {
        return docCategoryMapper.deleteDocCategoryByCategoryIds(Convert.toStrArray(categoryIds));
    }

    /**
     * 删除文档分类信息
     * 
     * @param categoryId 文档分类主键
     * @return 结果
     */
    @Override
    public int deleteDocCategoryByCategoryId(Long categoryId)
    {
        return docCategoryMapper.deleteDocCategoryByCategoryId(categoryId);
    }
}
